package com.crazy.crazyuserservice.controller.inner;

import com.crazy.crazymodel.model.entity.Customer;
import com.crazy.crazyserviceclient.service.UserFeignClient;
import com.crazy.crazyuserservice.service.ClientService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Date: 2024-05-06-20:34
 * @Author: Zheng Zeliang
 * 该服务仅内部调用，不是给前端的
 */
@RestController
@RequestMapping("/inner")
public class CustomerInnerController implements UserFeignClient {
    // TODO, 新建一个CustomerService
    @Resource
    private ClientService clientService;

    @Override
    @GetMapping("/get/id")
    public Customer getById(@RequestParam("customerID") int customerID){
        return clientService.getById(customerID);
    }

    @Override
    @GetMapping("/get/nameID")
    public Customer getByNameAndIdNumber(@RequestParam("name") String name,@RequestParam("idNumber") String idNumber) {
        return clientService.getByNameAndIdNumber(name,idNumber);
    }
}
